package com.luo.backend.dto;

import com.luo.backend.entity.Merchant;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 商家响应DTO
 */
public class MerchantResponse {
    
    private Long id;
    private String name;
    private String description;
    private String logo;
    private String phone;
    private String address;
    private BigDecimal rating;
    private Integer ratingCount;
    private BigDecimal minOrderAmount;
    private BigDecimal deliveryFee;
    private String businessHours;
    private Integer status;
    private Integer foodCount;  // 菜品总数
    private List<FoodPreviewDTO> previewFoods;  // 预览菜品（最多3个）
    
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
    private LocalDateTime createdAt;
    
    // 构造函数
    public MerchantResponse() {}
    
    public MerchantResponse(Merchant merchant) {
        this.id = merchant.getId();
        this.name = merchant.getName();
        this.description = merchant.getDescription();
        this.logo = merchant.getLogo();
        this.phone = merchant.getPhone();
        this.address = merchant.getAddress();
        this.rating = merchant.getRating();
        this.ratingCount = merchant.getRatingCount();
        this.minOrderAmount = merchant.getMinOrderAmount();
        this.deliveryFee = merchant.getDeliveryFee();
        this.businessHours = merchant.getBusinessHours();
        this.status = merchant.getStatus();
        this.createdAt = merchant.getCreatedAt();
    }
    
    // Getters and Setters
    public Long getId() {
        return id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public String getDescription() {
        return description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    public String getLogo() {
        return logo;
    }
    
    public void setLogo(String logo) {
        this.logo = logo;
    }
    
    public String getPhone() {
        return phone;
    }
    
    public void setPhone(String phone) {
        this.phone = phone;
    }
    
    public String getAddress() {
        return address;
    }
    
    public void setAddress(String address) {
        this.address = address;
    }
    
    public BigDecimal getRating() {
        return rating;
    }
    
    public void setRating(BigDecimal rating) {
        this.rating = rating;
    }
    
    public Integer getRatingCount() {
        return ratingCount;
    }
    
    public void setRatingCount(Integer ratingCount) {
        this.ratingCount = ratingCount;
    }
    
    public BigDecimal getMinOrderAmount() {
        return minOrderAmount;
    }
    
    public void setMinOrderAmount(BigDecimal minOrderAmount) {
        this.minOrderAmount = minOrderAmount;
    }
    
    public BigDecimal getDeliveryFee() {
        return deliveryFee;
    }
    
    public void setDeliveryFee(BigDecimal deliveryFee) {
        this.deliveryFee = deliveryFee;
    }
    
    public String getBusinessHours() {
        return businessHours;
    }
    
    public void setBusinessHours(String businessHours) {
        this.businessHours = businessHours;
    }
    
    public Integer getStatus() {
        return status;
    }
    
    public void setStatus(Integer status) {
        this.status = status;
    }
    
    public LocalDateTime getCreatedAt() {
        return createdAt;
    }
    
    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }
    
    public Integer getFoodCount() {
        return foodCount;
    }
    
    public void setFoodCount(Integer foodCount) {
        this.foodCount = foodCount;
    }
    
    public List<FoodPreviewDTO> getPreviewFoods() {
        return previewFoods;
    }
    
    public void setPreviewFoods(List<FoodPreviewDTO> previewFoods) {
        this.previewFoods = previewFoods;
    }
}
